#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 105;

int n, k;
string p;
string t;
int Next[N];
int ok[N];
void build_next(string s) {
  int t = -1;
  int i = 0;
  Next[0] = -1;
  int n = s.size();
  while (i < n) {
    if (t < 0 || p[i] == p[t]) {
      i++, t++;
      Next[i] = t;
    } else {
      t = Next[t];
    }
  }
  t = Next[n];
  while (t) {
    ok[t] = 1;
    t = Next[t];
  }
}
char ans[N];
void solve() {
  cin >> n >> k;
  cin >> p >> t;
  build_next(p);
  int plen = p.size(), tlen = t.size();
  int R = -1;
  rep(i, 0, tlen - 1) {
    if (t[i] == '1') {
      if (R >= i) {
        int suf = R + 1 - i;
        if (!ok[suf]) {
          cout << "No solution";
          return;
        }
        rep(j, suf, plen - 1) { ans[i + j] = p[j]; }
      } else {
        rep(j, 0, plen - 1) { ans[i + j] = p[j]; }
      }
      R = i + plen - 1;
    }
  }
  rep(i, 0, tlen - 1) {
    if (t[i] == '0') {
      int zero = -1, found = -1;
      rep(j, 0, plen - 1) {
        if (ans[i + j] && ans[i + j] != p[j]) {
          found = j;
          break;
        } else if (ans[i + j] == 0 && zero == -1) {
          zero = j;
        }
      }
      if (zero == -1 && found == -1) {
        cout << "No solution";
        return;
      }
      if (found == -1) {
        ans[i + zero] = p[zero] == 'a' ? 'b' : 'a';
      }
    }
  }
  rep(i, 0, n - 1) {
    if (!ans[i]) ans[i] = 'a';
    cout << ans[i];
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}